package com.cangxuan.manage.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        //创建API信息对象
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("藏选后台管理系统接口文档")
                .description("该接口用于藏选后台管理系统调用，开发者：洪老师")
                .version("1.0")
                .build();
        //返回Docket对象
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo)       //配置API信息
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cangxuan.manage.controller"))       //选择需要生成API接口的包路径
                .paths(PathSelectors.any())     //配置API接口路径，为所有路径
                .build();
    }

}
